#!/usr/bin/perl 

use strict;

use DBI;
use CGI;
use TTraker;

my $dbh;
initialize_dbi;
my $form_ref = parse_input();
print_header();

my %FORM_DATA = %$form_ref;
 
my $num = $FORM_DATA{'empNum'};
my $name = $FORM_DATA{'empName'};
my $job = $FORM_DATA{'empJob'};
my $loc = $FORM_DATA{'empLoc'};
my $period = $FORM_DATA{'payPeriod'};

my $msg = "";

generate_payroll_temp_table ($loc, $period, $num, $name);

db_disconnect();

############### SUBROUTINES FOLLOW ###############

	
sub generate_payroll_temp_table
{
	my $loc = $_[0];
	my $period = $_[1];
	my $num =  $_[2];
	my $name =  $_[3];
	clear_payroll_temp();
	write_payroll_temp_period($period);
	my $msg = update_payroll_temp_weeks($period);
	pay_activity_screen_from_pm  ($num, $name, $job, $loc, $msg);
}


